<!-- 推广商品 -->
<template>
	<view class="promotion-goods-wrap">
		<view style="background-color: #fafafa;">
			<view class="item-box">
				<view>请输入升级码：</view>
			</view>
			<view class="item-box">
				<u-input style="flex: 3;" v-model="upgradecode" type="text" :border="true" maxlength=8 />
			</view>
			<view class="item-box">
				<u-button style="flex: 1;" type="success" @tap="confirmUse">确定升级</u-button>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	components: {},
	data() {
		return {
			upgradecode: '',
		};
	},
	methods: {
		confirmUse() {
			let that = this;
			if (that.upgradecode == '' || that.upgradecode.length != 8) {
				this.$u.toast('请输入8位升级码')
			} else {
				uni.showLoading()
				that.$http('user.upgradecodeUse', {
					upgrade_code: that.upgradecode
				}).then(res => {
					uni.hideLoading()
					that.$u.toast(res.msg)
					if (res.code == 1) {
						setTimeout(function() {
							uni.reLaunch({url: '/pages/index/user'})
						}, 2000)
					}
				})
			}
		}
	}
};
</script>

<style lang="scss">
page {
	background-color: #fff;
}
.item-box {
	display: flex;
	padding:20rpx 30rpx;
}

// 推广商品列表
.goods-list {
	padding: 30rpx;
	border-bottom: 1rpx solid rgba(#dfdfdf, 0.5);
	position: relative;
	.share-btn {
		position: absolute;
		bottom: 30rpx;
		right: 30rpx;
		width: 160rpx;
		line-height: 60rpx;
		background: linear-gradient(90deg, #a36fff, #5336ff);
		box-shadow: 0px 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
		border-radius: 30rpx;
		font-size: 28rpx;
		color: #fff;
		font-weight: 500;
	}
	.img-box {
		border: 1rpx solid rgba(223, 223, 223, 0.43);
		margin-right: 30rpx;
		.goods-img {
			width: 150rpx;
			height: 150rpx;
		}
	}
	.goods-info {
		align-items: flex-start;
		height: 130rpx;

		.goods-title {
			width: 400rpx;
			font-size: 28rpx;
			font-weight: 500;
			color: #333333;
			margin-bottom: 10rpx;
		}
		.goods-des {
			width: 400rpx;
			font-size: 22rpx;
			font-weight: 500;
			color: #a8700d;
			margin-bottom: 10rpx;
		}
		.goods-price {
			margin-bottom: 10rpx;
			.price {
				font-size: 28rpx;
				font-weight: 500;
				color: #333333;
				margin-right: 16rpx;
			}
			.origin-price {
				font-size: 24rpx;

				font-weight: 400;
				text-decoration: line-through;
				color: #999999;
			}
		}
		.commission-num {
			font-size: 24rpx;
			font-weight: 500;
			color: #5e4ddf;
		}
	}
}
</style>
